#pragma once
#include"hashTable.h"

using namespace std;
namespace LXL
{
	template<class K, class V, class _hashFunc = hashFunc<K>>
	class unordered_map
	{
		struct MapKeyOfT
		{
			const K& operator()(const pair<const K, V>& kv)
			{
				return kv.first;
			}
		};

	public:
		iterator begin()
		{
			return _ht.begin();
		}
		iterator end()
		{
			return _ht.end();
		}
		pair<iterator, bool> insert(const pair<K, V>& data)
		{
			return _ht.Insert(data);
		}
		V& operator[](const K& key)
		{
			pair<iterator, bool> ret = _ht.Insert(make_pair(key, V()));
			return ret.first->second;
		}
	private:
		buckethash::hashTable<K, pair<const K, V>, _hashFunc, MapKeyOfT> _ht;
	};
}